package com.example.flushdemo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.flushdemo.domain.InvScene;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author jjh
 * @since 2022-06-26
 */
public interface InvSceneMapper extends BaseMapper<InvScene> {

    /**
     * 获取随机10条
     * @return
     */
    @Select("SELECT id,type_id \n" +
            "FROM inv_scene \n" +
            "WHERE is_deleted = 0 \n" +
            "and `status` = 'published' \n" +
            "and type_id \n" +
            "BETWEEN 4 and 6 \n" +
            "ORDER BY RAND() LIMIT #{num}")
    List<InvScene> getRandom(int num);

}
